// src/utils/api.js
import axios from "axios";

// 创建 axios 实例
const service = axios.create({
  timeout: 10000 // 请求超时时间10s
});

// 添加 request 方法，接收 config 参数并发起请求
export default {
  request(config) {
    return service.request(config).then(response => {
      const responseObj = {};
      responseObj.data = response.data
      responseObj.headers = response.headers
      return responseObj;
    }).catch(error => {
      console.error("请求失败:", error);
      throw error;
    });
  }
};
